﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace QuanLyKhachSan
{
    public partial class UC_Phong_CaiDatGia : System.Web.UI.UserControl
    {
        private int PhongID = 0;
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>        
        protected void Page_Load(object sender, EventArgs e)
        {   
         
            if (this.Request.QueryString["PhongID"] != null)
            {
                PhongID = int.Parse(this.Request.QueryString["PhongID"].ToString());
                Phong_Load();
                Gio_Phong_Load();                
            }
        }
        /// <summary>
        /// 
        /// </summary>
        protected void Gio_Phong_Load()
        {
            try
            {
                lstGiaTheoGio.DataSource = Gio_PhongBLL.Gio_Phong_GetItems(PhongID);
                lstGiaTheoGio.DataBind();
            }
            catch (Exception)
            {
                
                throw;
            }
        }            
        /// <summary>
        /// 
        /// </summary>
        protected void Phong_Load()
        {
            try
            {
                List<PhongInfo> list = new List<PhongInfo>();
                list = PhongBLL.Phong_GetItems(PhongID);
                lstPhong.DataSource = list;
                lstPhong.DataBind();
            }
            catch (Exception ex)
            {
                
                throw ex;
            }
        
        }
        public string FormatMoney(string GiaTien)
        {
            return String.Format("{0:C}", GiaTien);
        }
        #region Format
        public string PhanTram(string _phantram)
        {
            if (_phantram == "" || _phantram == "0")
                return "---";
            else
                return "[" + _phantram + " %]";
        }
        #endregion

    }
}